package WinterVacation.Day5;

public class Num2 {
    public static void main(String[] args) {
        int []arr = {1,3,4,5,6};
        int sum2 = sum(arr,arr.length);
        System.out.println(sum2);
    }
    public static int sum(int[] arr,int len){
        if(len == 1){
            return arr[0];
        }
        return arr[len - 1] + sum(arr,len - 1);
    }
}
